<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>Bootstrap 101 Template</title>

    <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link type="text/css" href="css/maolaoshifu.css" rel="stylesheet"/>

    <script src="js/jquery-1.11.0.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/getParameter.js"></script>
    <style>
        body {
            background: url(img/contextbc.jpg) no-repeat left top;
            background-size: 100%;
            background-attachment: fixed;
        }

        .navbar {
            height: auto;
        }

        .carousel img {
            width: 100%;
            height: auto;
        }


        .navbar-middle {
            float: right;
            font-size: 13px;
            color: white;
            vertical-align: middle;
            text-align: center;
            width: 200px;

        }

        .context {
            background-color: white;
            min-height: 400px;
            margin-top: 40px;
            color: black;
            font-size: 20px;
        }

        .rank {
            /*border: 1px black solid;*/
            margin-left: 70px;
            height: 400px;
            width: 200px;

        }

        ul {
            list-style: none;
        }

        #total > li {
            white-space: nowrap;
            text-overflow: ellipsis;
            -o-text-overflow: ellipsis;
            overflow: hidden;
            width: 150px;
        }

        .navbar {
            height: auto;
        }

        img[src="0"], img:not([src]) {
            opacity: 0;
        }

        .search-btn {
            float: left;
            border: 1px #66afe9 solid;
            text-align: center;
            width: 90px;
            line-height: 35px;
            background-color: #66afe9;
            height: 35px;
            margin-top: 25px;
        }

        .search-input {
            float: left;
            border: 2px #66afe9 solid;
            width: 400px;
            height: 35px;
            padding: 5px;
            margin-top: 25px;
        }

        .pageNum ul li {
            float: left;
            /*border: 1px solid #eee;*/
            margin-right: 10px;
            text-align: center;
            /*line-height: 40px;*/
        }
        .actGotop{position:fixed; _position:absolute; bottom:100px; right:25px; width:150px; height:195px; display:none;}
        .actGotop a,.actGotop a:link{width:150px; height:195px; display:inline-block; background:url(img/blog7year_gotop.png) no-repeat; _background:url(img/blog7year_gotop.gif) no-repeat; outline:none;}
        .actGotop a:hover{width:150px; height:195px; background:url(img/blog7year_gotopd.gif) no-repeat; outline:none;}
    </style>

</head>
<body>
<header class="container-fluid head">
    <div class="row">
        <nav class="navbar navbar-inverse navbar-default navbar-fixed-top">
            <div class="container-fluid">
                <!-- Brand and toggle get grouped for better mobile display -->
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                            data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" style="font-size: 30px;font-weight: bolder;color: white">学声</a>
                </div>

                <!-- Collect the nav links, forms, and other content for toggling -->
                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                    <ul class="nav navbar-nav" id="nav_container">
                        <!--<li><a href="#" style="font-size: 20px">首页<span class="sr-only">(current)</span></a></li>-->
                        <!--<li><a href="#" style="font-size: 18px">学术圈</a></li>-->
                        <!--<li><a href="#" style="font-size: 18px">吐槽会</a></li>-->
                        <!--<li><a href="#" style="font-size: 18px">男女那些事</a></li>-->
                        <!--<li><a href="#" style="font-size: 18px">废品重用</a></li>-->
                        <!--<li><a href="#" style="font-size: 18px">学术资源分享</a></li>-->
                        <!--<li><a href="#" style="font-size: 18px">下课后</a></li>-->
                    </ul>
                    <div class="navbar-middle">
                        <a href="Login.html" class="btn btn-default btn-lg active" role="button" id="login"
                           style="margin-right: 10px">登录</a>
                        <a href="#" class="btn btn-default btn-lg active" role="button" id="register">注册</a>
                    </div>
                    <div>
                        <ul class="nav navbar-nav navbar-right">
                            <li><a href="#">关于我们</a></li>
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
                                   aria-haspopup="true" aria-expanded="false">帮助<span class="caret"></span></a>
                                <ul class="dropdown-menu">
                                    <li><a href="#">使用说明</a></li>
                                    <li><a href="#">权益说明</a></li>
                                    <li><a href="#">联系方式</a></li>
                                    <li role="separator" class="divider"></li>
                                    <li><a href="#">感谢支持</a></li>
                                </ul>
                            </li>
                        </ul>
                    </div>
                </div><!-- /.navbar-collapse -->
            </div><!-- /.container-fluid -->
        </nav>
    </div>
</header>
<!--主体-->
<br><br><br>

<div class="container">
    <div class="row">
        <div style="float: left;width: 10px;height: 40px;background-color: #66afe9"></div>
        <div style="margin-top: 5px">
            <span style="color: #ff5f17;font-size: 20px;font-weight: bolder">搜索结果>>></span>
        </div>
        <input class="search-input" placeholder="请输入搜索内容" id="sinput">
        <a href="javascript:" class="search-btn" id="sbtn">搜索</a>
    </div>
    <div class="row">
        <div class="col-md-9">
            <div class="row context">
                <div style="margin: 10px;min-height: 380px;padding: 60px">
                    <div id="word">
                        <ul id="mainbox" style="line-height: 15px;padding: 0px;font-size: 15px">
                            <li>1</li>
                            <li>2</li>
                            <li>3</li>
                            <li>4</li>
                        </ul>
                    </div>
                    <br><br><br><br>
                    <br>
                    <div id="date" style="font-size: 15px;color: #999999;float: right"></div>
                </div>
                <div style="color: darkgrey;font-size: 16px;text-align: center">
                    <i></i>共
                    <span id="totalPage" style="color:darkgrey"></span>页<span id="totalCount"
                                                                              style="color:darkgrey;"></span>条
                </div>
            </div>
            <div class="pageNum row">
                <nav aria-label="Page navigation">
                    <ul class="pagination pagination-lg" id="pageNum">
                        <li>
                            <a href="#" aria-label="Previous">
                                <span aria-hidden="true">&laquo;</span>
                            </a>
                        </li>
                        <li><a href="#">1</a></li>
                        <li><a href="#">2</a></li>
                        <li><a href="#">3</a></li>
                        <li><a href="#">4</a></li>
                        <li><a href="#">5</a></li>
                        <li>
                            <a href="#" aria-label="Next">
                                <span aria-hidden="true">&raquo;</span>
                            </a>
                        </li>
                    </ul>
                </nav>
            </div>
        </div>
        <div class="col-md-3 rank">
            <div><img src="img/fire.jpg" class="img-circle" width="40px" height="40px"><span
                    style="font-size: 25px;font-weight: bolder">最受欢迎榜</span></div>
            <div style="overflow: hidden;white-space: nowrap; text-overflow: ellipsis;">
                <ul id="total"
                    style="overflow: hidden;white-space: nowrap; text-overflow: ellipsis; padding: 10px;line-height: 40px">
                </ul>
            </div>
        </div>
    </div>
</div>

<div style="position:fixed; top:50px; left:0px; width:100%;"></div>
<div class="mao_box">
    <div class="mao">
        <div class="mao_head">
            <div class="huawen">
                <div><!--头部花纹——左边橙色--></div>
            </div>
        </div>
        <div class="erduo">
            <div></div>
            <div></div>
        </div>
        <div class="yanjing">
            <div>
                <div class="yanquan">
                    <div></div>
                </div>
                <div class="yanquan_hedding">

                </div>
                <div class="hong"></div>
            </div>
            <div class="yan_right">
                <div class="yanquan">
                    <div></div>
                </div>
                <div class="yanquan_hedding">

                </div>
                <div class="hong"></div>
            </div>
            <div style="clear:both"></div>
        </div>
        <div class="face_huawen">
            <div class="face_huawen_huawen huawen_left">
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>

            </div>
            <div class="face_huawen_huawen huawen_right">
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>

            </div>
            <div style="clear:both"></div>
        </div>
        <div class="bizi">
            <div></div>
            <div></div>
            <div></div>
            <div></div>
        </div>
        <div class="zuiba_box">
            <div class="zuiba">
                <div></div>
                <div></div>
                <div></div>
            </div>
        </div>
    </div>
</div>
<div class="actGotop"><a href="javascript:;" title="Top"></a></div>


<!--<div><img src="img/r3.jpg" style="bottom: 0px;right: 0px;position: fixed" class="img-circle" width="100px"-->
          <!--height="100px" id="img"></div>-->
<div style="top: 100px;right: 10px;position: fixed">
    <span style="color: red;font-weight: bold">点这发帖>>></span>
    <img src="img/write.png" class="img-circle" width="70px" height="70px"
         onclick="javascript:location.href='writepage.html'">
</div>
<footer class="container-fluid xueba1" style="margin-top: 20px">
    <div class="row" style="background-color:#e6e6e6;color:#777777;text-align: center">
        <img src="img/logo.png" style="float: left" width="150px" height="60px">
        <div class="col-md-8">
            <p style="float: left">学声网为如弟，GC，大豚哥开发，内容尚未完善</p><br><br>
            <p style="float: left">版权由开发者所有，感谢支持</p>
        </div>
        <div style="margin-left:700px;margin-top: -55px" class="col-md-4">
            <a rel="nofollow" href="http://www.beian.miit.gov.cn"><span>备案号：</span>苏ICP备19067655号</a><br>
            <a href="#" style="color: #777777">联系方式</a>
        </div>
    </div>
</footer>
<script src="js/getParameter.js"></script>
<script>
    $(function () {
        $.post("user/find", {}, function (data) {
            $(".navbar-middle").html("<p>欢迎光临</p>" + data.username);
            $(".navbar-middle").append("<a href='/personalpage.html'>   &nbsp&nbsp   个人资料  &nbsp&nbsp </a>");
            $(".navbar-middle").append("<a href='user/quit'> 退出  </a>")
        })
    })
    $(function () {
        $.post("category/findAll", {}, function (data) {
            var lis = '<li><a href="index.html" style="font-size: 20px">首页<span class="sr-only">(current)</span></a></li>';
            for (var i = 0; i < data.length; i++) {
                var li = '<li><a href="searchpage.html?cid=' + data[i].cid + '"; style="font-size: 18px">' + data[i].cname + '</a></li>'
                lis += li;

            }
            $("#nav_container").html(lis)
        });
    });
</script>
<script>
    $(function () {
        var cid = getParameter("cid");
        var title = getParameter("title");
        if (title) {
            title = window.decodeURIComponent(title);
        }
        load(cid, null, title)
    });

    function load(cid, currentPage, title) {
        $.get("topic/pageQueryForcid", {cid: cid, currentPage: currentPage, title: title}, function (pb) {
            $("#totalPage").html(pb.totalPage);
            $("#totalCount").html(pb.totalCount);
            var lis = "";
            var firstpage = '<li><a href="javascript:load(' + cid + ',1,\'' + title + '\')">首页</a></li>';
            var beforePage = pb.currentPage - 1;
            if (beforePage <= 0) {
                beforePage = 1;
            }
            var previous = '<li> <a href="javascript:load(' + cid + ',' + beforePage + ',\'' + title + '\')" aria-label="Previous"> <span aria-hidden="true">&laquo;</span></a></li>';
            lis += firstpage;
            lis += previous;

            var begin;
            var end;
            if (pb.totalPage < 10) {
                begin = 1;
                end = pb.totalPage;
            } else {
                begin = pb.currentPage - 5;
                end = pb.currentPage + 4;
                if (begin < 1) {
                    begin = 1;
                    end = begin + 9;
                }
                if (end > pb.totalPage) {
                    end = pb.totalPage;
                    begin = end - 9;
                }
            }


            for (var i = begin; i <=end; i++) {
                var li;
                if (pb.currentPage == i) {
                    li = '<li class="active"><a href="javascript:load(' + cid + ',' + i + ',\''+title+'\')">' + i + '</a></li>';
                } else {
                    li = '<li><a href="javascript:load(' + cid + ',' + i + ',\''+title+'\')">' + i + '</a></li>';
                }
                lis += li;
            }
            // for (var i = 1; i <= pb.totalPage; i++) {
            //     var li;
            //     if (pb.currentPage == i) {
            //         li = '<li class="active"><a href="javascript:load(' + cid + ',' + i + ',\''+title+'\')">' + i + '</a></li>';
            //     } else {
            //         li = '<li><a href="javascript:load(' + cid + ',' + i + ',\''+title+'\')">' + i + '</a></li>';
            //     }
            //     lis += li;
            // }
            var next = pb.currentPage + 1;
            if (next >= pb.totalPage) {
                next = pb.totalPage;
            }
            var nextpage = '<li> <a href="javascript:load(' + cid + ',' + next + ',\'' + title + '\')" aria-label="Next"> <span aria-hidden="true">&raquo;</span> </a> </li>';

            var lastPage = '<li><a href="javascript:load(' + cid + ',' + pb.totalPage + ',\'' + title + '\')">尾页</a></li>';
            lis += nextpage;
            lis += lastPage;
            $("#pageNum").html(lis);

            var topic_list = "";
            for (var i = 0; i < pb.list.length; i++) {
                var topic = pb.list[i];
                var tli = '<li style="margin-top: 30px"><a style="color:#1f3b7b" href="contextpage.html?tid=' + topic.tid + '">' + topic.title + '</a></li><span style="float: right;color:#999999;font-size: 14px;font-weight: bolder">' + topic.username + '</span><hr style="border-bottom: 1px gainsboro solid;padding: 0px"/>'
                topic_list += tli;
                var tid = topic.tid;
            }
            if (pb.list.length>0) {
                $("#mainbox").html(topic_list);
            }
            else {
                $("#mainbox").html("<p>无内容</p>");
            }
            window.scrollTo(0,0)
        })
    }

    $(function () {
        $.post("context/totalthumb", {}, function (tf) {
            var lis = "";
            for (var i = 0; i < 10; i++) {
                var topic = tf[i];
                var li = '<li><a href="contextpage.html?tid=' + topic.tid + '" style="font-weight: bolder;">' + topic.title + '</a></li>';
                lis += li;
            }
            $("#total").html(lis);
        }, "json")
    })
</script>
<script>
    $("#sbtn").click(function () {
        var title = $("#sinput").val();
        var cid = getParameter("cid");
        location.href = "searchpage.html?cid=" + cid + "&title=" + title
    });
    $("#img").click(function () {
        $("html,body").stop().animate({
            scrollTop: 0
        }, 400)
    });
</script>
<script type="text/javascript">
    $(function(){
        $(window).scroll(function() {
            if($(window).scrollTop() >= 100){
                $('.actGotop').fadeIn(300);
            }else{
                $('.actGotop').fadeOut(300);
            }
        });
        $('.actGotop').click(function(){$('html,body').animate({scrollTop: '0px'}, 800);});
    });
</script>
</body>
</html>